package main
import "fmt"

const mod int = 1000000007

var n,m,k int

func power(a ,b int )(ans int){
	ans = 1
	for ;b!=0;{
		if b&1==1{
			ans = (ans*a)%mod
		}
		a = (a*a)%mod
		b>>=1
	}
	return
}

func main(){
	fmt.Scanf("%d%d%d",&n,&m)
	if k==1 {
		fmt.Printf("%d\n", n);
	}else {
		var r int = power(n,m)
		fmt.Printf("%d\n",r)
	}
}